Skip to content

Conversation

@radik878
Copy link

The client-stats command was relying on ctx.Done() inside run() to stop the ticker, but main() invoked app.Run(os.Args), which wraps RunContext(context.Background(), ...). Because the root context was not cancelable, ctx.Done() would never fire on process termination, preventing graceful shutdown. This change introduces a signal-aware cancelable root context using signal.NotifyContext and switches to app.RunContext(rctx, os.Args). As a result, when SIGINT or SIGTERM is received, rctx is canceled, the cli.Context’s embedded context is canceled, and the select case on ctx.Done() triggers, ensuring the ticker is stopped and the loop exits cleanly. This behavior aligns with how beacon-chain wires its context and fixes the shutdown semantics without altering run() logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant